const fs = require('fs')
const path = require('path')

const writeFile = (filePath, text = '') => {
    if (filePath) {
        let dirPath = path.resolve(filePath, '../')
        if (!fs.existsSync(dirPath)) {
            fs.mkdirSync(dirPath)
        }
        fs.writeFileSync(filePath, text)

    }

}

writeFile('/Users/leiwenwei/demo/template-weapp-ts/dist/env.config.js', '123')